package com.leetcode.LeetCode精选TOP面试题;

import com.leetcode.common.model.ListNode;

/**
 * @author 覃国强
 * @date 2022-07-07 16:45
 */
public class 题库_0206_反转链表 {

  static
  class Solution {
    public ListNode reverseList(ListNode head) {
      ListNode prev = null;
      ListNode node = head;
      while (node != null) {
        ListNode next = node.next;
        node.next = prev;
        prev = node;
        node = next;
      }
      return prev;
    }
  }


}
